package com.taxt.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.taxt.R;
import com.taxt.app.AppAdapter;
import com.taxt.http.api.DeclareDataApi;
import com.taxt.http.api.JobDataApi;

import java.util.List;

/**
 * author : wq
 * <p>
 * time   : 2018/11/05
 * desc   : 纳税明细列表
 */
public final class DeclareDataAdapter extends AppAdapter<DeclareDataApi.Bean.SalaryListDTO> {
    private final List<DeclareDataApi.Bean.SalaryListDTO> mSelectBusiness;

    public DeclareDataAdapter(Context context, List<DeclareDataApi.Bean.SalaryListDTO> mSelectBusines) {
        super(context);
        this.mSelectBusiness = mSelectBusines;
    }


    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private TextView mJobTitle, mJobNum, mJobWork,mJobYear;
        private TextView mJobDate, mJobOutWork;

        private ViewHolder() {
            super(R.layout.declare_data_item);
            mJobTitle = findViewById(R.id.job_title);
            mJobNum = findViewById(R.id.job_num);
            mJobWork = findViewById(R.id.job_work);
            mJobDate = findViewById(R.id.job_date);
            mJobOutWork = findViewById(R.id.job_work_out);
            mJobYear=findViewById(R.id.job_year);
        }

        @Override
        public void onBindView(int position) {
            DeclareDataApi.Bean.SalaryListDTO bean = getItem(position);
            mJobTitle.setText("工资薪金");
            mJobYear.setText(bean.getTaxPeriod());
            mJobNum.setText(bean.getIncomeCategoryItem());
            mJobWork.setText(bean.getWithholdingAgentName());
            mJobDate.setText(bean.getIncome()+"元");
            mJobOutWork.setText(bean.getDeclaredTaxAmount()+"元");
        }
    }
}